package com.edu.study.base.stuCourseSutdent.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.stuCourseSutdent.domain.StuCourseSutdent;
import com.edu.study.base.stuCourseSutdent.service.IStuCourseSutdentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学员课程学习情况Controller
 * 
 * @author zw
 * @date 2021-06-30
 */
@RestController
@RequestMapping("/stuCourseSutdent/stuCourseSutdent")
public class StuCourseSutdentController extends BaseController
{
    @Autowired
    private IStuCourseSutdentService stuCourseSutdentService;

    /**
     * 查询学员课程学习情况列表
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdent:stuCourseSutdent:list')")
    @GetMapping("/list")
    public TableDataInfo list(StuCourseSutdent stuCourseSutdent)
    {
        startPage();
        List<StuCourseSutdent> list = stuCourseSutdentService.selectStuCourseSutdentList(stuCourseSutdent);
        return getDataTable(list);
    }

    /**
     * 导出学员课程学习情况列表
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdent:stuCourseSutdent:export')")
    @Log(title = "学员课程学习情况", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(StuCourseSutdent stuCourseSutdent)
    {
        List<StuCourseSutdent> list = stuCourseSutdentService.selectStuCourseSutdentList(stuCourseSutdent);
        ExcelUtil<StuCourseSutdent> util = new ExcelUtil<StuCourseSutdent>(StuCourseSutdent.class);
        return util.exportExcel(list, "stuCourseSutdent");
    }

    /**
     * 获取学员课程学习情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdent:stuCourseSutdent:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(stuCourseSutdentService.selectStuCourseSutdentById(id));
    }

    /**
     * 新增学员课程学习情况
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdent:stuCourseSutdent:add')")
    @Log(title = "学员课程学习情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StuCourseSutdent stuCourseSutdent)
    {
        return toAjax(stuCourseSutdentService.insertStuCourseSutdent(stuCourseSutdent));
    }

    /**
     * 修改学员课程学习情况
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdent:stuCourseSutdent:edit')")
    @Log(title = "学员课程学习情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StuCourseSutdent stuCourseSutdent)
    {
        return toAjax(stuCourseSutdentService.updateStuCourseSutdent(stuCourseSutdent));
    }

    /**
     * 删除学员课程学习情况
     */
    @PreAuthorize("@ss.hasPermi('stuCourseSutdent:stuCourseSutdent:remove')")
    @Log(title = "学员课程学习情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(stuCourseSutdentService.deleteStuCourseSutdentByIds(ids));
    }
}
